<template>
	<view  class="uni-container">

			<view  class="uni-panel-h" v-for="(item ,index) in grassTypes"
				@click="goDetailPage(item)">
				<text class="uni-panel-text">{{item.zwmc}}</text>
				<text class="uni-panel-icon uni-icon">&#xe470;</text>
			</view>
		
	</view>
</template>

<script>
	import {
		getInfo,
		setInfo
	} from '@/core/unicommon/storyageInfo.js'
	export default {
		data() {
			return {
				grassTypes:[],
				grasstype:false
			}
		},
		onLoad(e){
			if(e && e.data){
				console.log(e)
				let data=JSON.parse(decodeURIComponent(e.data))	
				this.grasstype=data.grasstype
				getInfo("userdata").then(res=>{
					this.grassTypes=res.data.grassType.filter(t=>t.ydNumber==data.ydNumber&& t.yfNumber==data.yfNumber)
					let yd=res.data.yd.find(t=>t.ydNumber==data.ydNumber)
					if(yd.grasslandType!="人工草地"){
						this.grasstype=false
					}else{
						this.grasstype=true
					}
				})
				
			}
			
		},
		methods: {
			
			goDetailPage(item){
				if(this.grasstype){
					uni.navigateTo({
						url: "/pages/sampleplot/samplesquare/artificialGrass?data="+ encodeURIComponent(JSON.stringify(item))
					})
				}else{
					uni.navigateTo({
						url: "/pages/sampleplot/samplesquare/natureGrass?data="+ encodeURIComponent(JSON.stringify(item))
					})
				}
			}
		}
	}
</script>

<style scoped>
@import '@/common/uni-nvue.css';
.uni-panel-h{
	margin-top: 10rpx;
}
</style>
